package xju.rjxy.shop.web.controller;

import xju.rjxy.shop.common.framework.simplemvc.RequestMapping;
import xju.rjxy.shop.common.utils.Result;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class HomeController {

    @RequestMapping("/index.do")
    public void index(HttpServletRequest request, HttpServletResponse response) throws IOException {
        response.setContentType("application/json;charset=UTF-8");
        Result.JSONResultMap result = Result.success("服务运行正常，欢迎访问社区API");
        response.getWriter().write(com.alibaba.fastjson.JSON.toJSONString(result));
    }

    @RequestMapping("/")
    public void root(HttpServletRequest request, HttpServletResponse response) throws IOException {
        response.setContentType("application/json;charset=UTF-8");
        Result.JSONResultMap result = Result.success("服务运行正常，根路径欢迎页");
        response.getWriter().write(com.alibaba.fastjson.JSON.toJSONString(result));
    }
}
